package com.goktech.service.imp;

import com.goktech.entity.Book;
import com.goktech.entity.User;
import com.goktech.entity.borrow;
import com.goktech.mapper.BorrowMapper;
import com.goktech.service.BorrowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("BorrowService")
public class borrowServiceImp implements BorrowService {

    @Autowired
    BorrowMapper borrowMapper;

    @Override
    public int insertBorrow(borrow b) {
        return borrowMapper.insertBorrow(b);
    }

    @Override
    public int deleteBorrow(borrow b) {
        return borrowMapper.deleteBorrow(b);
    }

    @Override
    public int updateBorrow(borrow b) {
        return borrowMapper.updateBorrow(b);
    }

    @Override
    public List<Map<String, Object>> findByUserId(User u,int begin,int end) {
        return borrowMapper.findByUserId(u,begin,end);
    }

    @Override
    public List<Map<String, Object>> findByBookId(Book b) {
        return borrowMapper.findByBookId(b);
    }

    @Override
    public List<Map<String, Object>> findByAll(int begin,int end) {
        return borrowMapper.findByAll(begin,end);
    }

    @Override
    public List<Map<String, Object>> findByLikeZhanghao(User u) {
        return borrowMapper.findLikeZhanghao(u);
    }

    @Override
    public List<Map<String, Object>> findByLikeUserName(User u) {
        return borrowMapper.findLikeUsername(u);
    }

    @Override
    public Map<String, Object> findByBorrid(borrow b) {
        return borrowMapper.findByBorrid(b);
    }

    @Override
    public borrow findByBorrow(borrow b) {
        return borrowMapper.findByBorrow(b);
    }

    @Override
    public int updateBorrow1(borrow b) {
        return borrowMapper.updateBorrow1(b);
    }


    @Override
    public List<borrow> findIsReturn(User user){return borrowMapper.findIsReturn(user);}
}
